package pl.ydp.components.mathcell.mathrecognizer.engine
{
	public class Functions
	{
		
		public static function joinToBaseArray(base:Array, tail:Array):void{
			for each (var element:Object in tail){
				base.push(element);
			}
		}
		
		//------------------------------------------------------------------
		
		
		public static function joinArrays(a1:Array, a2:Array):Array{
			var output:Array = new Array;
			var element:Object;
			 
			for each (element in a1){
				output.push(element);
			}
			
			for each (element in a2){
				output.push(element);
			}
			
			return output;
			
		}
		
		//------------------------------------------------------------------
		
		public static function findMinimumIndex(arr:Array):Number{
			
			if (arr.length < 1){
				return 0;
			}
			
			var minIndex:Number = 0;
			var minValue:Number = arr[0];
			
			for (var k2:Number = 0 ; k2 < 4 ; k2 ++ ){
				if (arr[k2] < minValue){
					minValue = arr[k2];
					minIndex = k2;
				}
			}
			
			return minIndex;
			
		}
	}
}